From a99d55edd4044a3c2f34067046f1a81c9415274b Mon Sep 17 00:00:00 2001 From: Rob Hoes Date: Wed, 6 Nov 2013 17:49:46 +0000 Subject: [PATCH] libxl: idl: add Enumeration.value_namespace property This allows setting the namespace for values of an Enumeration to be different from the namespace of the Enumeration itself. Signed-off-by: Rob Hoes Acked-by: Ian Campbell --- tools/libxl/idl.py | 5 ++++- tools/libxl/idl.txt | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/libxl/idl.py b/tools/libxl/idl.py index f4908dde17..e4dc79bf16 100644 --- a/tools/libxl/idl.py +++ b/tools/libxl/idl.py @@ -136,7 +136,7 @@ class EnumerationValue(object): self.valuename = str.upper(name) self.rawname = str.upper(enum.rawname) + "_" + self.valuename - self.name = str.upper(enum.namespace) + self.rawname + self.name = str.upper(enum.value_namespace) + self.rawname self.value = value class Enumeration(Type): @@ -144,6 +144,9 @@ class Enumeration(Type): kwargs.setdefault('dispose_fn', None) Type.__init__(self, typename, **kwargs) + self.value_namespace = kwargs.setdefault('value_namespace', + self.namespace) + self.values = [] for v in values: # (value, name) diff --git a/tools/libxl/idl.txt b/tools/libxl/idl.txt index 019acbe0f4..439aedea77 100644 --- a/tools/libxl/idl.txt +++ b/tools/libxl/idl.txt @@ -90,6 +90,13 @@ Complex type-Classes idl.Enumeration A class representing an enumeration (named integer values). + This class has one property besides the ones defined for the Type + class: + + Enumeration.value_namespace: (default: namespace) + + The namespace in which the values of the Enumeration (see below) reside. + This prefix is prepended to the name of the value. The values are available in the list Enumeration.values. Each element in the list is of type idl.EnumerationValue. -- 2.30.2